Even until a couple of years ago, creating a website along with a blog that embeded both code and text, required specific knowledge of HTML. Tools such as markdown and R Markdown, have abstracted the difficult part of writing HTML code for us, so that we can focus on content and creating reproducible analyses. Building on these very tools, the blogdown package by Yihue Xie has made it that much easier to create websites that allow you to showcase your scripts, code and reports, while also maintaining a public portfolio, i.e., having an online presence.
In this part, we will create a minimal working example of a blogdown website. I have provided detailed screenshots of each step. Note: the screenshots provided here are from a Linux operating system, however it will be similar on a Windows or Mac.
R for required packages:install.packages("pacman")
pacman::p_load(knitr, rmarkdown, pander, ggplot2, cowplot)
pacman::p_load_gh('rstudio/blogdown')
(Note for Mac Users: the first time I installed Hugo, you might need to install homebrew).
library(blogdown)
blogdown::install_hugo(force = TRUE)
blogdown::hugo_version()Choose a theme from https://themes.gohugo.io/ and find the link to the theme’s GitHub repository.
blogdown::new_site(theme = "gcushen/hugo-academic", theme_example = TRUE)After this is complete, you should quit and then reopen the project. Upon reopening, RStudio will recognize the project as a website.
config.toml - The configuration file for your website. This file tells Hugo how it should render your site, as well as define its menus, and set various other site-wide parameters. This file will look different for every theme, but they will all contain some basic components. baseurl set this to the desired URL for your site, in this case baseurl = “https://
publishDir is relative to current directory. so can use ../ , or use full path “/home/sahir/git_repositories/cssc2018.github.io” but dont use “~/git_repositories/cssc2018.github.io”